/* -*-c++-*- IfcGears - www.ifcgears.com  - Copyright (C) 2011 Fabian Gerold
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

#pragma once

#include <osg/Array>
namespace osg
{
	class StateSet;
	class Node;
	class Drawable;
	class Geode;
	class Group;
}
namespace carve
{
	namespace input
	{
		struct PolyhedronData;
	}
	namespace poly
	{
		class Polyhedron;
	}
	namespace geom
	{
		template<unsigned int ndim> struct vector;
	}
	namespace math
	{
		struct Matrix;
	}
}

osg::Geode* createCoordinateAxes();
osg::Group* createCoordinateAxesArrows();
osg::Geode* createQuarterCircles();
void WireFrameModeOn( osg::StateSet* state );
void WireFrameModeOn( osg::Node* srisdNode );
void WireFrameModeOn( osg::Drawable* drawable );
void WireFrameModeOff( osg::StateSet* state );
void WireFrameModeOff( osg::Node* srisdNode );
void WireFrameModeOff( osg::Drawable* drawable );
void HiddenLineModeOn( osg::Group* node );
void HiddenLineModeOff( osg::Group* node );
void cullFrontBack( bool front, bool back, osg::StateSet* stateset );

osg::Vec3d computePolygonNormal( const osg::Vec3dArray* polygon );
osg::Vec3f computePolygonNormal( const osg::Vec3Array* polygon );
carve::geom::vector<3> computePolygonNormal( const std::vector<carve::geom::vector<3> >& polygon );
carve::geom::vector<3> computePolygon2DNormal( const std::vector<carve::geom::vector<2> >& polygon );

void computeInverse( const carve::math::Matrix& matrix_a, carve::math::Matrix& inv );

void extrude( const std::vector<std::vector<carve::geom::vector<3> > >& paths, const carve::geom::vector<3> dir, carve::input::PolyhedronData& poly_data );
